package thread;


class PrintTask implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName() + ": " + i);
        }
    }
}
/**
 * @Author Justin Parker
 * @Date 2024/7/20 0020 9:10
 * @Version 1.0
 */
public class ThreadPriorityDemo01 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new PrintTask(), "线程1");
        Thread t2 = new Thread(new PrintTask(), "线程2");
        Thread t3 = new Thread(new PrintTask(), "线程3");
        t1.setPriority(Thread.MIN_PRIORITY);
        t2.setPriority(Thread.NORM_PRIORITY);
        t3.setPriority(Thread.MAX_PRIORITY);
        t1.start();
        t2.start();
        t3.start();

    }
}
